<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
    <title>美策平台</title>
    <link rel="icon" type="image/png" href="/img/icon.png">
    <link rel="stylesheet" type="text/css" href="../datepicker/jquery-ui.min.css">
    <link type="text/css" rel="stylesheet" href="../css/app.css"/>
    <link type="text/css" rel="stylesheet" href="../css/loginMobile.css"/>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script src="../datepicker/jquery-ui.min.js"></script>
    <script type="text/javascript" src="/pc/js/all.js"></script>
</head>
<body id="Ibody">
<!--
	制作：陈道祥
	页面：员工类型
	更新：九哥
-->




<!-----------员工类型页面---------->
<div class="stepTwo" id="IstepThreeEmployee">
    <br>
    <div class="identity">
        <b>服装产业链上下游注册</b>
    </div>
    <div class="employeeItem" data-id="2" id="staff2">我是公司员工</div>
    <div class="employeeItem" data-id="1" id="staff1">我是工厂员工</div>
    <div class="nextStepDiv">
        <span class="prevStep" onclick="history.go(-1)">返回</span>
        <span class="nextStep" onclick="setSave()">保存</span>
    </div>
</div>
<!-----------员工类型页面---------->





<!-----------提示信息---------->
<input type="hidden" id="staffType" value="0">
<div id="errMsg"></div>
<!-----------提示信息---------->
</body>
<script type="text/javascript" src="../js/loginStaff.js"></script>
<script>
    (function(){
        var cate = getUserCate();
        $('.employeeItem').removeClass('staffClick');
        $('#staff'+cate).addClass('staffClick');
        $('#staffType')[0].value = cate;
    })();
    function getUserCate(){
        var userInfo = cacheGet('userInfo');
        return userInfo.cate;
    }
    /**
     * 员工类型选择
     * */
    $('.employeeItem').on('click',function(){
        var staffType = this.getAttribute('data-id');
        $('.employeeItem').removeClass('staffClick');
        $(this).addClass('staffClick');
        $('#staffType')[0].value = staffType;
    });
    /**
     * 保存设置
     * */
    function setSave(){
        var staffType = $('#staffType').val();
        var userInfo = cacheGet('userInfo'); //获取用户信息
        if (staffType==0) { getErrMsg('员工类型未设置！'); return; }
        if (userInfo==null || userInfo.token=='undefined') {
            getErrMsg('没有登录！'); return;
        }
        //存储到本地
        var dataCache = {
            app_access:app_access,
            token:userInfo.token,
            type:userInfo.type,
            cate:staffType
        };
        cacheSet('userInfo',dataCache);
//        if (staffType==1) { //工厂员工信息
//            window.location.href = 'staffJobFac.html';
//        }
//        else if (staffType==2) { //公司员工信息
//            window.location.href = 'staffJobCom.html';
//        }
//        else {
//            getErrMsg('未知错误！');
//        }
        var staffPer = localStorage.getItem('staffPer');
        if (staffPer) {
            staffPer = JSON.parse(staffPer);
            staffPer.type = 1;
            localStorage.setItem('staffPer', JSON.stringify(staffPer));
        }
        window.location.href = '/h5/login/staffList.html';
    }
</script>
</html>